<template>
  <div>
    <p style="margin-bottom: 100px">主页</p>
    <div>
      <el-button type="primary" @click="jumpList">跳转列表页</el-button>
      <el-button type="primary" @click="jumpLogin">退出</el-button>
    </div>
    <hr />
    <div>
      <p style="margin-bottom: 20px">
        <router-link :to="{ path: 'artclelist', query: { pageSize: 20, pageNum: 2, total: 100 } }"
          >跳转列表页2</router-link>
      </p>
      <p>
        <router-link :to="{ name: 'ArtclePage', params: { id: 123 } }">跳转详情页</router-link>
      </p>
    </div>
  </div>
</template>

<!-- <script>
import { REMOVE_TOKEN } from '@/utils/token'
export default {
  name: 'Home',
  methods: {
    jumpList() {
      /*   this.$router.push({
        name: 'Artclelist',
        query: { pageSize: 10, pageNum: 1, total: 100 }
      }) */
      this.$router.push({
        path: 'artclelist',
        query: { pageSize: 20, pageNum: 2, total: 100 }
      })
      /*    this.$router.replace({
        path: 'artclelist',
        query: { pageSize: 10, pageNum: 1, total: 100 }
      }) */
    },
    jumpLogin() {
      REMOVE_TOKEN()
      this.$router.push({ path: '/login' })
    }
  }
}
</script> -->

<script setup>
defineOptions({
  name: 'Home'
})

import { REMOVE_TOKEN } from '@/utils/token'
import { useRouter } from 'vue-router'
const router = useRouter()
const jumpList = () => {
  router.push({
    path: 'artclelist',
    query: { pageSize: 20, pageNum: 2, total: 100 }
  })
}
const jumpLogin = () => {
  REMOVE_TOKEN()
  router.push({ path: '/login' })
}
</script>
